home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software 2000
/
Software 2000 Volume 1 (Disc 1 of 2).iso
/
utilities
/
u200.dms
/
u200.adf
/
Eliza.bas
< prev
next >
Wrap
BASIC Source File
|
1992-04-24
|
7KB
|
243 lines
' Eliza.bas
' a program originally written 1979
' by Jeff Shrager and Steve North
' revamped for Amiga in November 1990
' by Phil South
' for Amiga Format
' To run this program use either AmigaBasic, Hisoft Basic
' or your favourite Basic interpreter
init:
DIM C$(72),I$(72),K$(72),F$(72),S$(72),R$(72),p$(72),Z$(72)
DIM S(36),R(36),N(36),p%(8)
p%(0)=180: p%(1)=0: p%(2)=140: p%(3)=1: p%(4)=26000
p%(5)=64: p%(6)=10: p%(7)=0: p%(8)=0
N1=36:N2=12:N3=112
PRINT "PLEASE TURN ON YOUR 'CAPS LOCK' KEY."
PRINT "TO STOP TYPE 'SHUT UP'..."
FOR X=1 TO N1+N2+N3
READ Z$
NEXT X
FOR X=1 TO N1
READ S(X),L:R(X)=S(X):N(X)=S(X)+L-1
NEXT X
PRINT "HI! I'M ELIZA. WHAT'S YOUR PROBLEM?"
' Input section
inmput:
INPUT I$
I$=" "+I$+" "
' Strip apostrophes
apos:
FOR L=1 TO LEN(I$): IF MID$(I$,L,1)="'" THEN I$=LEFT$(I$,L-1)+RIGHT$(I$,LEN(I$)-L): GOTO apos
czechshut:
IF L+4<=LEN(I$) THEN GOTO nd ELSE GOTO rep
nd:
IF MID$(I$,L,4)="SHUT" THEN Z9$="SHUT UP..": PRINT Z9$: END
rep:
NEXT L
IF I$=p$ THEN Z9$="PLEASE DON'T REPEAT YOURSELF!": PRINT Z9$: GOTO inmput
' Find keyword in I$
findkey:
RESTORE
S=0
FOR K=1 TO N1
READ K$
IF S>0 THEN donald
FOR L=1 TO LEN(I$)-LEN(K$)+1
IF MID$(I$,L,LEN(K$))=K$ THEN S=K:T=L:F$=K$
NEXT L
donald:
NEXT K
IF S>0 THEN K=S:L=T: GOTO louis
K=36: GOTO scrooge
louis:
RESTORE:FOR X=1 TO N1:READ Z$:NEXT X
C$=" "+RIGHT$(I$,LEN(I$)-LEN(F$)-L+1)
FOR X=1 TO N2/2
READ S$,R$
FOR L=1 TO LEN(C$)
IF L+LEN(S$)>LEN(C$) THEN dewey
IF MID$(C$,L,LEN(S$))<>S$ THEN dewey
C$=LEFT$(C$,L-1)+R$+RIGHT$(C$,LEN(C$)-L-LEN(S$)+1)
L=L+LEN(R$)
GOTO hewey
dewey:
IF L+LEN(R$)>LEN(C$) THEN hewey
IF MID$(C$,L,LEN(R$))<>R$ THEN hewey
C$=LEFT$(C$,L-1)+S$+RIGHT$(C$,LEN(C$)-L-LEN(R$)+1)
L=L+LEN(S$)
hewey:
NEXT L
NEXT X
IF MID$(C$,2,1)=" " THEN C$=RIGHT$(C$,LEN(C$)-1)
' Now get reply
scrooge:
RESTORE:FOR X=1 TO N1+N2:READ Z$:NEXT X
FOR X=1 TO R(K):READ F$:NEXT X
R(K)=R(K)+1
IF R(K)>N(K) THEN R(K)=S(K)
IF RIGHT$(F$,1)<>"*" THEN Z9$=F$: PRINT F$:p$=I$: GOTO inmput
Z9$=LEFT$(F$,LEN(F$)-1)+C$:PRINT Z9$
p$=I$: GOTO inmput
' Program Data
' Keywords
810 DATA "CAN YOU","CAN I","YOU ARE","YOURE","I DONT","I FEEL"
820 DATA "WHY DONT YOU","WHY CANT I","ARE YOU","I CANT","I AM","IM "
830 DATA "YOU ","I WANT","WHAT","HOW","WHO","WHERE","WHEN","WHY"
840 DATA "NAME","CAUSE","SORRY","DREAM","HELLO","HI ","MAYBE"
850 DATA " NO","YOUR","ALWAYS","THINK","ALIKE","YES","FRIEND"
860 DATA "COMPUTER","NOKEYFOUND"
' String data for conjugations
900 DATA " ARE "," AM ","WERE ","WAS "," YOU "," I ","YOUR ","MY "
910 DATA " IVE "," YOUVE "," IM "," YOURE "
' Replies
950 DATA "DON'T YOU BELIEVE THAT I CAN*"
960 DATA "PERHAPS YOU WOULD LIKE TO BE ABLE TO*"
970 DATA "YOU WANT ME TO BE ABLE TO*"
980 DATA "PERHAPS YOU DON'T WANT TO*"
990 DATA "DO YOU WANT TO BE ABLE TO*"
1000 DATA "WHAT MAKES YOU THINK I AM*"
1010 DATA "DOES IT PLEASE YOU TO BELIEVE I AM*"
1020 DATA "PERHAPS YOU WOULD LIKE TO BE*"
1030 DATA "DO YOU SOMETIMES WISH YOU WERE*"
1040 DATA "DON'T YOU REALLY*"
1050 DATA "WHY DON'T YOU*"
1060 DATA "DO YOU WISH TO BE ABLE TO*"
1070 DATA "DOES THAT TROUBLE YOU?"
1080 DATA "TELL ME MORE ABOUT SUCH FEELINGS."
1090 DATA "DO YOU OFTEN FEEL*"
1100 DATA "DO YOU ENJOY FEELING*"
1110 DATA "DO YOU REALLY BELIEVE I DON'T*"
1120 DATA "PERHAPS IN GOOD TIME I WILL*"
1130 DATA "DO YOU WANT ME TO*"
1140 DATA "DO YOU THINK YOU SHOULD BE ABLE TO*"
1150 DATA "WHY CAN'T YOU*"
1160 DATA "WHY ARE YOU INTERESTED IN WHETHER OR NOT I AM*"
1170 DATA "WOULD YOU PREFER IF I WERE NOT*"
1180 DATA "PERHAPS IN YOUR FANTASIES I AM*"
1190 DATA "HOW DO YOU KNOW YOU CAN'T*"
1200 DATA "HAVE YOU TRIED?"
1210 DATA "PERHAPS YOU CAN NOW*"
1220 DATA "DID YOU COME TO ME BECAUSE YOU ARE*"
1230 DATA "HOW LONG HAVE YOU BEEN*"
1240 DATA "DO YOU BELIEVE IT IS NORMAL TO BE*"
1250 DATA "DO YOU ENJOY BEING*"
1260 DATA "WE WERE DISCUSSING YOU-- NOT ME."
1270 DATA "OH, I*"
1280 DATA "YOU'RE NOT REALLY TALKING ABOUT ME, ARE YOU?"
1290 DATA "WHAT WOULD IT MEAN TO YOU IF YOU GOT*"
1300 DATA "WHY DO YOU WANT*"
1310 DATA "SUPPOSE YOU SOON GOT*"
1320 DATA "WHAT IF YOU NEVER GOT*"
1330 DATA "I SOMETIMES ALSO WANT*"
1340 DATA "WHY DO YOU ASK?"
1350 DATA "DOES THAT QUESTION INTEREST YOU?"
1360 DATA "WHAT ANSWER WOULD PLEASE YOU THE MOST?"
1370 DATA "WHAT DO YOU THINK?"
1380 DATA "ARE SUCH QUESTIONS ON YOUR MIND OFTEN?"
1390 DATA "WHAT IS IT THAT YOU REALLY WANT TO KNOW?"
1400 DATA "HAVE YOU ASKED ANYONE ELSE?"
1410 DATA "HAVE YOU ASKED SUCH QUESTIONS BEFORE?"
1420 DATA "WHAT ELSE COME TO MIND WHEN YOU ASK THAT?"
1430 DATA "NAMES DON'T INTEREST ME."
1440 DATA "I DON'T CARE ABOUT NAMES-- PLEASE GO ON."
1450 DATA "IS THAT THE REAL REASON?"
1460 DATA "DON'T ANY OTHER REASONS COME TO MIND?"
1470 DATA "DOES THAT REASON EXPLAIN ANYTHING ELSE?"
1480 DATA "WHAT OTHER REASONS MIGHT THERE BE?"
1490 DATA "PLEASE DON'T APOLOGIZE!"
1500 DATA "APOLOGIES ARE NOT NECESSARY."
1510 DATA "WHAT FEELINGS DO YOU HAVE WHEN YOU APOLOGIZE."
1520 DATA "DON'T BE SO DEFENSIVE!"
1530 DATA "WHAT DOES THAT DREAM SUGGEST TO YOU?"
1540 DATA "DO YOU DREAM OFTEN?"
1550 DATA "WHAT PERSONS APPEAR IN YOUR DREAMS?"
1560 DATA "ARE YOU DISTURBED BY YOUR DREAMS?"
1570 DATA "HOW DO YOU DO ... PLEASE STATE YOUR PROBLEM."
1580 DATA "YOU DON'T SEEM QUITE CERTAIN."
1590 DATA "WHY THE UNCERTAIN TONE?"
1600 DATA "CAN'T YOU BE MORE POSITIVE?"
1610 DATA "YOU AREN'T SURE?"
1620 DATA "DON'T YOU KNOW?"
1630 DATA "ARE YOU SAYING NO JUST TO BE NEGATIVE?"
1640 DATA "YOU ARE BEING A BIT NEGATIVE."
1650 DATA "WHY NOT?"
1660 DATA "ARE YOU SURE?"
1670 DATA "WHY NO?"
1680 DATA "WHY ARE YOU CONCERNED ABOUT MY*"
1690 DATA "WHAT ABOUT YOUR OWN*"
1700 DATA "CAN YOU THINK OF A SPECIFIC EXAMPLE?"
1710 DATA "WHEN?"
1720 DATA "WHAT ARE YOU THINKING OF?"
1730 DATA "REALLY, ALWAYS?"
1740 DATA "DO YOU REALLY THINK SO?"
1750 DATA "BUT YOU ARE NOT SURE YOU*"
1760 DATA "DO YOU DOUBT YOU*"
1770 DATA "IN WHAT WAY?"
1780 DATA "WHAT RESEMBLANCE DO YOU SEE?"
1790 DATA "WHAT DOES THE SIMILARITY SUGGEST TO YOU?"
1800 DATA "WHAT OTHER CONNECTIONS DO YOU SEE?"
1810 DATA "COULD THERE REALLY BE SOME CONNECTION?"
1820 DATA "HOW?"
1830 DATA "YOU SEEM QUITE POSITIVE."
1840 DATA "ARE YOU SURE?"
1850 DATA "I SEE."
1860 DATA "I UNDERSTAND."
1870 DATA "WHY DO YOU BRING UP THE TOPIC OF FRIENDS?"
1880 DATA "DO YOUR FRIENDS WORRY YOU?"
1890 DATA "DO YOUR FRIENDS PICK ON YOU?"
1900 DATA "ARE YOU SURE YOU HAVE ANY FRIENDS?"
1910 DATA "DO YOU IMPOSE ON YOUR FRIENDS?"
1920 DATA "PERHAPS YOUR LOVE FOR FRIENDS WORRIES YOU."
1930 DATA "DO COMPUTERS WORRY YOU?"
1940 DATA "ARE YOU TALKING ABOUT ME IN PARTICULAR?"
1950 DATA "ARE YOU FRIGHTENED BY MACHINES?"
1960 DATA "WHY DO YOU MENTION COMPUTERS?"
1970 DATA "WHAT DO YOU THINK MACHINES HAVE TO DO WITH YOUR PROBLEM?"
1980 DATA "DON'T YOU THINK COMPUTERS CAN HELP PEOPLE?"
1990 DATA "WHAT IS IT ABOUT MACHINES THAT WORRIES YOU?"
2000 DATA "SAY, DO YOU HAVE ANY PSYCHOLOGICAL PROBLEMS?"
2010 DATA "WHAT DOES THAT SUGGEST TO YOU?"
2020 DATA "I SEE."
2030 DATA "I'M NOT SURE I UNDERSTAND YOU FULLY."
2040 DATA "COME COME ELUCIDATE YOUR THOUGHTS."
2050 DATA "CAN YOU ELABORATE ON THAT?"
2060 DATA "THAT IS QUITE INTERESTING"
' Data for finding replies
DATA 1,3,4,2,6,4,6,4,10,4,14,3,17,3,20,2,22,3,25,3
DATA 28,4,28,4,32,3,35,5,40,9,40,9,40,9,40,9,40,9,40,9
DATA 49,2,51,4,55,4,59,4,63,1,63,1,64,5,69,5,74,2,76,4
DATA 80,3,83,7,90,3,93,6,99,7,106,6
END